package com.xcw.controller;

import com.xcw.CommonCheckResult;
import com.xcw.DataTransFor;
import com.xcw.enums.Contanst;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Author bhx
 * @Date 2022/11/8 1:56
 * @Description TODO
 */
@RestController
@RequestMapping("com/xx/cc")
public class requestController {

    @RequestMapping(value = "/downLoadSpecialDeviceDiff")
    public String downLoadSpecialDeviceDiff(@RequestBody Map<String,Object> param) {

        Map<String, Object> commonCheckResults = (Map<String, Object>) param.get("commonCheckResult");
        CommonCheckResult checkResult = new CommonCheckResult();

        checkResult.setServiceName(DataTransFor.dataToString((String) commonCheckResults.get("service_name"))).setReturnBureau(DataTransFor.dataToString((String) commonCheckResults.get("for_ju")))
                .setDeviceType(DataTransFor.dataToString((String) commonCheckResults.get("device_ype"))).setArea(DataTransFor.dataToString((String) commonCheckResults.get("belong_area")))
                .setCompany(DataTransFor.dataToString((String) commonCheckResults.get("company"))).setCheckItem(DataTransFor.dataToString((String) commonCheckResults.get("check_item")))
                .setDeviceName(DataTransFor.dataToString((String) commonCheckResults.get("device_name"))).setNewTime(DataTransFor.dataToString((String) commonCheckResults.get("new_time")))
                .setVtlCount(DataTransFor.dataToNumber(String.valueOf(commonCheckResults.get("vtl_count")))).setStdCount(DataTransFor.dataToNumber(String.valueOf(commonCheckResults.get("std_count"))))
                .setMoreCount(DataTransFor.dataToNumber(String.valueOf(commonCheckResults.get("more_count")))).setLeakCount(DataTransFor.dataToNumber(String.valueOf(commonCheckResults.get("less_count"))))
                .setErrCount(DataTransFor.dataToNumber(String.valueOf(commonCheckResults.get("error_count")))).setRedundantCount(DataTransFor.dataToNumber(String.valueOf(commonCheckResults.get("redundant_count"))))
                .setCorrectCount(DataTransFor.dataToNumber(String.valueOf(commonCheckResults.get("right_count"))));
        System.out.println(checkResult);
        Integer checkDeviceId = Integer.valueOf((String) param.get("checkDeviceId"));
        Integer taskId = Integer.valueOf((String) param.get("taskId"));

        return "abv";
    }
}
